package com.sure.trafficvideo;

import java.util.ArrayList;

import com.sure.trafficvideo.adapter.VideoListAdapter;
import com.sure.trafficvideo.model.VideoGroup;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ExpandableListView;

public class IndexActivity extends Activity {
	
	private ExpandableListView expandListView;
	private VideoListAdapter mAdapter;
	private ArrayList<VideoGroup> items;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		expandListView = (ExpandableListView) findViewById(R.id.video_list);
		mAdapter = new VideoListAdapter(this);
		expandListView.setAdapter(mAdapter);
		String[] groupNames = getResources().getStringArray(R.array.area_array);
		items = new ArrayList<VideoGroup>();
		for(int i=0; i<groupNames.length; i++) {
			VideoGroup group = new VideoGroup();
			group.groupId = i;
			group.groupName = groupNames[i];
			items.add(group);
		}
		
		mAdapter.setData(items);
		mAdapter.notifyDataSetChanged();
	}

	
}
